package org.beetl.support;

import jodd.petite.meta.PetiteBean;
import jodd.petite.meta.PetiteInitMethod;
import jodd.petite.meta.PetiteInject;

@PetiteBean
public class GenericBeetlJoddService<T> extends DefaultGenericService<T> {

 @PetiteInject
 protected GenericBeetlBuilder genericBeetlBuilder;
 protected IDGenerationType idGenType = IDGenerationType.UUID;
 protected String primaryKeyFields = "cityId";

 @SuppressWarnings("unchecked")
 @PetiteInitMethod
 public void init() {
  LogSupport.info("Init GenericBeetlJoddService with entity class:{}", this.getEntityClass().getSimpleName());
  this.setDao((GenericDao<T>) genericBeetlBuilder.buildDao(this.getEntityClass(), primaryKeyFields, idGenType));
 }
}
